{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "from sklearn import tree\n",
    "\n",
    "music_data = pd.read_csv('music.csv')\n",
    "\n",
    "X = music_data.drop('genre', axis=1)\n",
    "y = music_data['genre']\n",
    "\n",
    "model = DecisionTreeClassifier()\n",
    "model.fit(X, y)\n",
    "\n",
    "tree.export_graphviz(model,\n",
    "                     out_file='music.dot',\n",
    "                     feature_names=X.columns,\n",
    "                     class_names=y.unique(),\n",
    "                     label='all',\n",
    "                     rounded=True,\n",
    "                     filled=True)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "NALLM",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
